/********************************************************************
FileName    :   Bll_UserList.cs
CreateTime  :   2015-10-27 04:10
BaseClass   :   Bll_UserList
FileType    :   .cs
Author      :  minjie
Description :   Bll_UserListBLL层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Collections.Generic;

using System.Data;
using OS.Common;
using OS.DAL;
namespace OS.BLL
{
	/// <summary>
	/// Bll_UserList的摘要说明。
	/// </summary>
public partial class   Bll_UserList 
  	{ 
     		      
  		private readonly Dal_UserList dal=new  Dal_UserList(); 
  		public  Bll_UserList() 
  		{} 
  		 
  		#region  Method 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public bool  Add(UserList_Entity model) 
  		{ 
  			return dal.Add(model); 
  		} 
   
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  string  AddStr(UserList_Entity model) 
  		{ 
  			return dal.AddStr(model); 
  		} 
   
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(UserList_Entity model) 
  		{ 
  			return dal.Update(model); 
  		} 
   
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete(string  UserNo) 
  		{ 
  			 
  			return dal.Delete(UserNo); 
  		} 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string UserNolist ) 
  		{ 
  			return dal.DeleteList(UserNolist ); 
  		} 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public UserList_Entity GetModel(string  UserNo) 
  		{ 
  			 
  			return dal.GetModel(UserNo); 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			return dal.GetList(strWhere); 
  		} 
  		/// <summary> 
  		/// 获得前几行数据 
  		/// </summary> 
  		public DataSet GetList(int Top,string strWhere,string filedOrder) 
  		{ 
  			return dal.GetList(Top,strWhere,filedOrder); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<UserList_Entity> GetModelList(string strWhere) 
  		{ 
  			DataSet ds = dal.GetList(strWhere); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<UserList_Entity> GetModelList(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			DataSet ds = dal.GetListByPage(strWhere, orderby, startIndex, endIndex); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<UserList_Entity> DataTableToList(DataTable dt) 
  		{ 
  			List<UserList_Entity> modelList = new List<UserList_Entity>(); 
  		  if (dt!=null ) 
  		  { 
  			int rowsCount = dt.Rows.Count; 
  			if (rowsCount > 0) 
  			{ 
  				UserList_Entity   model; 
  				for (int n = 0; n < rowsCount; n++) 
  				{ 
  					model = new UserList_Entity();					 
  				model.UserId= dt.Rows[n]["UserId"].ToString(); 
  				model.UserNo= dt.Rows[n]["UserNo"].ToString(); 
  				model.UserPass= dt.Rows[n]["UserPass"].ToString(); 
  				model.UserTName= dt.Rows[n]["UserTName"].ToString(); 
  				model.UserDetail= dt.Rows[n]["UserDetail"].ToString(); 
  				model.UserTel= dt.Rows[n]["UserTel"].ToString(); 
  				model.UserMobile= dt.Rows[n]["UserMobile"].ToString(); 
  				model.UserEmail= dt.Rows[n]["UserEmail"].ToString(); 
  				model.UserIcon= dt.Rows[n]["UserIcon"].ToString(); 
  				if(dt.Rows[n]["UserSex"]!=null&&dt.Rows[n]["UserSex"].ToString()!="") 
  				{ 
  					model.UserSex=int.Parse(dt.Rows[n]["UserSex"].ToString()); 
  				} 
  				model.UserZW= dt.Rows[n]["UserZW"].ToString(); 
  				if(dt.Rows[n]["UserAge"]!=null&&dt.Rows[n]["UserAge"].ToString()!="") 
  				{ 
  					model.UserAge=int.Parse(dt.Rows[n]["UserAge"].ToString()); 
  				} 
  				model.UserRemark= dt.Rows[n]["UserRemark"].ToString(); 
  				model.UserAddress= dt.Rows[n]["UserAddress"].ToString(); 
  				model.UserWebSite= dt.Rows[n]["UserWebSite"].ToString(); 
  				model.UserRole= dt.Rows[n]["UserRole"].ToString(); 
  				if(dt.Rows[n]["UserLevel"]!=null&&dt.Rows[n]["UserLevel"].ToString()!="") 
  				{ 
  					model.UserLevel=int.Parse(dt.Rows[n]["UserLevel"].ToString()); 
  				} 
  				if(dt.Rows[n]["UserLastLoginDateTime"]!=null&&dt.Rows[n]["UserLastLoginDateTime"].ToString()!="") 
  				{ 
  					model.UserLastLoginDateTime=DateTime.Parse(dt.Rows[n]["UserLastLoginDateTime"].ToString()); 
  				} 
  				if(dt.Rows[n]["UserCreateTime"]!=null&&dt.Rows[n]["UserCreateTime"].ToString()!="") 
  				{ 
  					model.UserCreateTime=DateTime.Parse(dt.Rows[n]["UserCreateTime"].ToString()); 
  				} 
  				model.UserRestrict= dt.Rows[n]["UserRestrict"].ToString(); 
  				 
  					modelList.Add(model); 
  				} 
  			} 
  		} 
  			return modelList; 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetAllList() 
  		{ 
  			return GetList(""); 
  		} 
   
  		/// <summary> 
  		/// 获取记录总数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			return  dal.GetRecordCount(strWhere); 
  		} 
  #endregion 
      
  	} 
  
}
